package com.hmy.finance.dal.po;

import com.baomidou.mybatisplus.annotation.*;
import com.hmy.finance.api.bo.core.request.enums.FeeTypeEnum;
import com.hmy.finance.common.enums.BusinessBillTypeEnum;
import com.hmy.finance.common.enums.PaymentStatusEnum;
import com.hmy.finance.common.enums.ProfitLossStatusEnum;
import lombok.Data;
import org.apache.ibatis.type.EnumTypeHandler;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 租赁设备损益费用明细表
 *
 * @author songkf
 * @TableName device_profit_loss_detail
 */
@TableName(value = "device_profit_loss_detail")
@Data
public class DeviceProfitLossDetailPo implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = -4407329988917183258L;
    /**
     * 主键标识
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 设备租赁记录ID
     */
    @TableField(value = "device_rental_record_id")
    private Long deviceRentalRecordId;

    /**
     * 损益业务记录ID
     */
    @TableField(value = "profit_loss_record_id")
    private Long profitLossRecordId;

    /**
     * 设备ID
     */
    @TableField(value = "device_id")
    private Long deviceId;

    /**
     * 设备编号
     */
    @TableField(value = "device_no")
    private String deviceNo;

    /**
     * 合同ID
     */
    @TableField(value = "contract_id")
    private Long contractId;

    /**
     * 合同编号
     */
    @TableField(value = "contract_no")
    private String contractNo;
    /**
     * 业务单据类型 (1-进场, 2-退场, 3-索赔, 4-报停, 5-应收)
     */
    @TableField(value = "business_bill_type", typeHandler = EnumTypeHandler.class)
    private BusinessBillTypeEnum businessBillType;

    /**
     * 业务单据类型 (1-进场运费, 2-进场运费减免, 3-退场运费, 4-退场运费减免, 5-改装费, 6-改装费减免, 7-索赔费用, 8-报停费用, 9-应收调整)
     */
    @TableField(value = "fee_type", typeHandler = EnumTypeHandler.class)
    @EnumValue
    private FeeTypeEnum feeType;

    /**
     * 费用金额
     */
    @TableField(value = "fee")
    private BigDecimal fee;
    /**
     * 天数（目前仅用于补录报停）
     */
    @TableField(value = "days")
    private Double days;
    /**
     * 费用发生时间
     */
    @TableField(value = "fee_incurred_time")
    private LocalDateTime feeIncurredTime;

    /**
     * 已支付金额
     */
    @TableField(value = "paid_amount")
    private BigDecimal paidAmount;
    /**
     * 未支付金额
     */
    @TableField(value = "unpaid_amount")
    private BigDecimal unpaidAmount;
    /**
     * 冲抵核销状态
     *
     * @see PaymentStatusEnum
     */
    @TableField(value = "payment_status", typeHandler = EnumTypeHandler.class)
    private PaymentStatusEnum paymentStatus;
    /**
     * 损益状态
     */
    @TableField(value = "status", typeHandler = EnumTypeHandler.class)
    private ProfitLossStatusEnum status;

    /**
     * 备注
     */
    @TableField(value = "remarks")
    private String remarks;

    @TableLogic
    private Boolean isDeleted;
}